classdef dotsQueryableEyeRandom < dotsQueryableEye
    % @class dotsQueryableEyeRandom
    % Acquires and classifies fake point of gaze and pupil diameter data.
    % @details
    % dotsQueryableEyeRandom extends the dotsQueryableEye superclass to
    % acquire fake, random "point of gaze" and "pupil diameter" data.  The
    % x, y, and pupil diameter will walk randomly.  dotsQueryableEyeRandom
    % is a place holder for a real dotsQueryableEye* class.
    % @details
    % dotsQueryableEyeRandom is a usable class.  Use the newObject()
    % method of dotsTheQueryablesManager to create new
    % dotsQueryableEyeRandom objects.
    % @ingroup queryable
    
    properties
        % false x-position, as though from eye tracker hardware
        inputX;
        
        % false y-position, as though from eye tracker hardware
        inputY;
        
        % false pupil diameter, as though from eye tracker hardware
        inputDiameter;
    end
    
    methods
        % Acquire device-specific resources.
        % @details
        % Since dotsQueryableEyeRandom is just a placeholder, does not try
        % to connect to a device and always returns true.
        function isOpen = openEyeTracker(self)
            self.inputRect = [-1 -1 2 2]*100;
            self.xyRect = [1 2 3 4];
            self.dMax = 1000;
            
            self.inputX = 0;
            self.inputY = 0;
            self.inputDiameter = self.dMax/2;
            
            isOpen = true;
        end
        
        % Release device-specific resources.
        % @details
        % Since dotsQueryableEyeRandom is just a placeholder, does nothing;
        function closeEyeTracker(self)
        end
        
        % Read raw data from the acquired eye tracker device.
        % @details
        % Generates a random data sample for each of the x, y, and pupil
        % diameter dimensions.  Each dimensions will walk randomly.
        function data = readRawData(self)
            walkStep = (2*rand(1,3))-1;
            self.inputX = self.inputX + walkStep(1);
            self.inputY = self.inputY + walkStep(2);
            self.inputDiameter = self.inputDiameter + walkStep(3);
            data = [ ...
                self.xID, self.inputX, GetSecs; ...
                self.yID, self.inputY, GetSecs; ...
                self.diameterID, self.inputDiameter, GetSecs];
        end
    end
end